/**
 * NearShop
 * shopDisCountListAction.java
 * com.android.nearshop.io.protocol.in
 * 
 */
package com.android.nearshop.io.protocol.in;

import android.util.Log;

import com.android.nearshop.io.protocol.out.DisShopList;

/*********************************************************
 * @author : zhaohua
 * @version : 2012-8-11
 * @see : 根据参数，查询优惠商家。
 * @Copyright : copyrights reserved by personal 2007-2012
 **********************************************************/
public class ShopDisCountListAction extends SoapAction<DisShopList>
{

    /**
     * 查询优惠商家。 会员日应用
     * @param week 0为周日，周末为周的第一日。
     * @param lon 经度
     * @param lat 纬度
     */
    public ShopDisCountListAction(int week, double lon, double lat)
    {
        super(ACTION_TYPE.ACTION_SHOP,"shopDisCountList");
        setWeek(week);
        addJsonParam("position", lon+","+lat);
    }
    
    /**
     * 设置星期
     * @param week
     */
    public void setWeek(int week)
    {
        addJsonParam("week", week+"");
    }
    
    /**
     * 镇区id
     * @param areaId
     */
    public void setAreaId(int areaId)
    {
        addJsonParam("areaId",areaId > 0 ? areaId +"" : null);
    }
    
    /**
     * 排序方式有三种：距离、星级、访问量；
     * @param distance 是否按距离
     * @param distanceDesc ture：降序，否则升序
     * @param recommend 是否按星级
     * @param recommendDesc ture：降序，否则升序
     * @param clickrates 是否按访问量
     * @param clickratesDesc ture：降序，否则升序
     */
    public void setOrderStruct(
            boolean distance, boolean distanceDesc,
            boolean recommend , boolean recommendDesc,
            boolean clickrates , boolean clickratesDesc)
    {
        ProtocolHelper.setOrderStruct(this, distance, distanceDesc, recommend, recommendDesc, clickrates, clickratesDesc);
    }
    
    /* (non-Javadoc)
     * @see com.android.nearshop.io.protocol.in.SoapAction#parseJson(java.lang.String)
     */
    @Override
    protected DisShopList parseJson(String response) throws Exception
    {
        Log.d(getMethod(), getMethod() + "response: \n " + response);
        DisShopList res = new DisShopList();
        res.parseData(response);
        return res;
    }

}
